<?php

use Phinx\Db\Adapter\MysqlAdapter;
use think\migration\Migrator;

class PaymentConfigTable extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('payment_config');
        $table->addColumn('store_id','integer',['limit' => MysqlAdapter::INT_REGULAR,'comment' => '店铺id'])->addIndex('store_id');
        $table->addColumn('sort','integer',['limit' => MysqlAdapter::INT_REGULAR,'default' =>0, 'comment' => '支付排序']);
        $table->addColumn('type','integer',['limit' => MysqlAdapter::INT_TINY,'comment' => '支付类型 1 微信 2 支付宝 3 余额']);
        $table->addColumn('config','json',['comment' => '支付配置','null' => true]);
        $table->addColumn('status','boolean',['limit' => 1, 'comment' => '1 启用 2 禁用']);
        $table->addTimestamps('create_time','update_time');
        $table->create();
    }
}
